package utils;

import android.text.TextUtils;
import android.widget.TextView;

import java.lang.reflect.Method;
import java.util.UUID;

import kitwee.com.kanpad.MyMultiDexApplication;

/**
 * Created by sven on 2017/7/8.
 */

public class OnlyDeviceIDUtil {
    private String deviceKanBanID = "";
    String serialnum ="";


    private void getOnlyID() {

        try {
            Class<?> c = Class.forName("android.os.SystemProperties");
            Method get = c.getMethod("get", String.class, String.class);
            serialnum = (String) (get.invoke(c, "ro.serialno", "unknown"));
            if (serialnum != null && !TextUtils.equals("", serialnum) && !TextUtils.equals("unknown", serialnum)) {
                deviceKanBanID = serialnum;
            } else {
                DeviceUuidFactory factory = new DeviceUuidFactory(MyMultiDexApplication.getContext());
                UUID deviceUuid = factory.getDeviceUuid();
                System.out.println(deviceUuid.toString());
//                String mac = getMac();
//                if (mac != null && mac != "") {
//                    String md5 = getMD5(deviceUuid.toString() + mac);
//                    deviceKanBanID = md5;
//                } else {
//                    String md5 = getMD5(deviceUuid.toString());
//                    deviceKanBanID = md5;
//                }

            }
//ID,是只需要生成设备唯一Id
        } catch (Exception ignored) {
            ignored.printStackTrace();
        }
    }
}
